﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Shove.Web.UI;

public partial class UserControls_GoodConsult : UCBase 
{
    public UserControls_GoodConsult()
    {
        Name = "商品咨询";

        swpas = new ShoveWebPartAttribute[13];

        swpas[0] = new ShoveWebPartAttribute_Int("控件宽度", "1,1004", 759, "控件宽度");
        swpas[1] = new ShoveWebPartAttribute_Int("导航单元格高度", "1,500", 23, "导航单元格高度");
        swpas[2] = new ShoveWebPartAttribute_Int("导航单元格宽度", "1,600", 139, "导航单元格宽度");
        swpas[3] = new ShoveWebPartAttribute_Int("标题行高", "1,200", 25, "标题行高");
        swpas[4] = new ShoveWebPartAttribute_Int("每页显示的行数", "1,40", 6, "每页显示的行数");

        swpas[5] = new ShoveWebPartAttribute_Color("分割线颜色", "#cccccc", "分割线颜色");
        swpas[6] = new ShoveWebPartAttribute_Color("控件边框颜色", "#E7C890", "控件边框颜色");

        swpas[7] = new ShoveWebPartAttribute_Image("标题前图标", "", "images/UserControls/point_yuan.jpg", "标题前图标");
        swpas[8] = new ShoveWebPartAttribute_Image("导航背景图片1", "", "images/UserControls/bg_gold_23.jpg", "导航背景图片1");
        swpas[9] = new ShoveWebPartAttribute_Image("导航背景图片2", "", "images/UserControls/bg_gold_23_2.jpg", "导航背景图片2");

        swpas[10] = new ShoveWebPartAttribute_Text("导航文本样式", "", "black12", "导航文本样式");
        swpas[11] = new ShoveWebPartAttribute_Text("标题样式", "", "td14", "标题样式");
        swpas[12] = new ShoveWebPartAttribute_Text("日期CSS样式", "", "help12", "日期CSS样式");
    }

    private void Initlayout()
    {
        //tabctr.Width = swpAttributes[0];
        //tabctr.BgColor = swpAttributes[6];

        //tdsign.Width = swpAttributes[2];
        //tdsign.Height = swpAttributes[1];
        //tdsign.Style.Add("background-image", "url('" + swpAttributes[8] + "')");
        //tdsign.Attributes.Add("class", swpAttributes[10]);

        //tdspace.Style.Add("background-image", "url('" + swpAttributes[9] + "')");
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        Initlayout();
        BindData();
    }

    private void BindData()
    {
        this.Page1.FindType = 0;
        this.Page1.PageSize = Shove._Convert.StrToInt(swpAttributes[4], 6);
        this.Page1.Field1 = "";
        this.Page1.Field2 = "";
        this.Page1.Like1 = "";
        this.Page1.Like2 = "";

        Page1.DataListID = dlGoodConsult;
        Page1.TableName = "V_Site_GoodComment";
        Page1.Condition = "where ShopID=" + _Site.ID + " and CustomerID=" + _Customer.ID + " and Type=1";
    }

    protected void dlGoodConsult_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        HtmlImage img = (HtmlImage)e.Item.FindControl("img");
        img.Src = "~/" + swpAttributes[7];

        HtmlTableCell tdtitle = (HtmlTableCell)e.Item.FindControl("tdtitle");
        tdtitle.Height = swpAttributes[3];
        tdtitle.Attributes.Add("class", swpAttributes[11]);

        HtmlGenericControl span1 = (HtmlGenericControl)e.Item.FindControl("span1");
        span1.Attributes.Add("class", swpAttributes[12]);

        HtmlTableCell tdline = (HtmlTableCell)e.Item.FindControl("tdline");
        tdline.BgColor = swpAttributes[5];
    }
}
